

        function updateAds(){
            
            $('.about .round .content .picTxt div .prev').removeClass('prev');
            $('.about .round .content .picTxt div .next').removeClass('next');
            var length = $('.about .round .content .picTxt div .now')[0].parentNode.children.length;
            if($('.about .round .content .picTxt div .now')[0] == $('.about .round .content .picTxt div .now')[0].parentNode.children[length - 1]){
                $('.about .round .content .picPalace .now').siblings('*:eq(0)').addClass('next');
                $('.about .round .content .txtPalace .now').siblings('*:eq(0)').addClass('next');
                console.log('next 1');
            }else{
                $('.about .round .content .picTxt div .now').next().addClass('next');
                console.log('next 2');
            }

            if($('.about .round .content .picTxt div .now')[0] == $('.about .round .content .picTxt div .now')[0].parentNode.children[0]){
                $('.about .round .content .picPalace .now').siblings('*:eq(' + (length - 2) + ')').addClass('prev');
                $('.about .round .content .txtPalace .now').siblings('*:eq(' + (length - 2) + ')').addClass('prev');
                console.log('prev 1');
            }else{
                $('.about .round .content .picTxt div .now').prev().addClass('prev');
                console.log('prev 2');
            }
            
        }
        var zIndex = 2;
        var updateDelay = null;
        var rollNums = null;
        var watchingAnimation = null;
        var numAdds = [];
            for(var m = 0;m < $('.numAdd').length;m++){
                $('.numAdd')[m].ind = m;
                numAdds.push($('.numAdd')[m]);
            }
            
        $(document).ready(function(){
            updateAds();
            $('.about .round .content .picTxt span').click(function(){
                clearTimeout(updateDelay);
                updateDelay = null;
                zIndex++;
                var prev = $(this)[0].className.indexOf('prev') >= 0?true:false;
                $('.about .round .content .picTxt div .now').removeClass('now');
                $('.about .round .content .picTxt .txtPalace .current').removeClass('current');
                if(prev){
                    $('.about .round .content .picTxt .txtPalace .prev').addClass('current');
                    $('.about .round .content .picTxt div .prev').addClass('now');
                    $('.about .round .content .picTxt .picPalace .prev').removeClass('current');
                }else{
                    $('.about .round .content .picTxt .txtPalace .next').addClass('current');
                    $('.about .round .content .picTxt div .next').addClass('now');
                    $('.about .round .content .picTxt .picPalace .next').removeClass('current');
                }
                $('.about .round .content .picTxt .picPalace .now').css('z-index',String(zIndex));
                setTimeout(function(){
                    $('.about .round .content .picTxt .picPalace .now').addClass('current');
                },10)
                updateAds();
                updateDelay = setTimeout(function(){
                    for(var c = 0;c < $('.about .round .content .picPalace .current').length;c++){
                        if($('.about .round .content .picPalace .current')[c].className.indexOf('now') < 0){
                            $('.about .round .content .picPalace .current:eq(' + c + ')').removeClass('current');
                            c -= 1;
                        }
                    }
                },500);
            })
            function makeInterval(el){
                var index = el.ind;
                var addVal = 1;
                el.timeOut = function(){
                    if(nums[index] > 100){
                        addVal = Math.ceil(nums[index] / 100);
                    }
                    setTimeout(function(){
                        if(addVal <= nums[index] - el.innerText){
                            el.time = parseInt(600 / (nums[index] - el.innerText));
                            setTimeout(function(){
                                el.innerText = String(Number(el.innerText) + addVal);
                                el.timeOut();
                            },el.time);
                        }else{
                            el.innerText = String(nums[index]);
                        }
                    },10);
                }
                el.timeOut();
            }
            var nums = [];
            for(var n = 0;n < $('.num .val').length;n++){
                $('.num .val')[n].ind = n;
                nums.push(Number($('.num .val')[n].innerText));
            }
            console.log(nums);
            $('.num .val').text('1');
            
            rollNums = setInterval(function(){
                if(beginningDelay != null){
                    beginningDelay += 10;
                    if(beginningDelay <= animateDelayCount) return false;
                }
                if(!numAdds.length){
                    clearInterval(rollNums);
                };   
               
                for(var r = 0;r < numAdds.length;r++){
                    var ele_top = numAdds[r].offsetTop + numAdds[r].offsetHeight;
                    var ele_h = 0;
                    var window_h = window.innerHeight;
                    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
                    var addInd = numAdds[0].ind;
                    if((
                        ele_top < window_h + scrollTop)
                        &&
                        (ele_h + ele_top > scrollTop)
                        ||
                        (ele_top < window_h && scrollTop < ele_top)){
                            for(var s = 0;s < $('.numAdd:eq('+ addInd + ')').find('.num .val').length;s++){
                                makeInterval($('.numAdd:eq('+ addInd + ')').find('.num .val')[s]);
                            }
                            numAdds.splice(r,1);
                            if(!numAdds.length){
                                clearInterval(rollNums);
                            }
                    }
                }
            },10);

            watchingAnimation = setInterval(function(){
                var tipTop = $('main .about .round .circle.content .tips .overBtm')[0].getBoundingClientRect().top;
                var tip_h = $('main .about .round .circle.content .tips .overBtm')[0].offsetHeight;
                var bgTop = $('main .about .round .circle.bg')[0].getBoundingClientRect().top;
                var bg_h = $('main .about .round .circle.bg')[0].offsetHeight;
                if(window.innerWidth > 900){
                    if(window.innerHeight - tipTop >= tip_h){
                        $('main .about .round .circle.content .tips').addClass('frozen');
                        setTimeout(function(){
                            $('main .about .round .circle.bg').addClass('frozen');
                        },600)
                        clearInterval(watchingAnimation);
                    }
                }else{
                    if(bg_h / 2 + bgTop <= window.innerHeight / 2){
                        $('main .about .round .circle.bg').addClass('frozen');
                    }
                    if(tip_h / 2 + tipTop <= window.innerHeight / 2){
                        $('main .about .round .circle.content .tips').addClass('frozen');
                        clearInterval(watchingAnimation);
                    }
                }
                
            },10)
        })